#include "parawidget.h"
#include "ui_parawidget.h"

ParaWidget::ParaWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ParaWidget)
{
    ui->setupUi(this);
}

ParaWidget::~ParaWidget()
{
    delete ui;
}


/*Tr 修改*/
void ParaWidget::on_pushButton_Tr_clicked()
{
    float Tr;
    bool isOk;
    Tr = ui->lineEdit_Tr->displayText().toFloat(&isOk);
    if(isOk){
        emit TrReset(Tr);
    }else{
        ui->lineEdit_Tr->setText("操作失败");
    }

}


void ParaWidget::on_pushButton_Tz_clicked()
{
    float Tz;
    bool isOk;
    Tz = ui->lineEdit_Tz->displayText().toFloat(&isOk);
    if(isOk){
        emit TzReset(Tz);
    }else{
        ui->lineEdit_Tz->setText("操作失败");
    }

}


void ParaWidget::on_pushButton_DeltaK_clicked()
{
    float DeltaK;
    bool isOk;
    DeltaK = ui->lineEdit_DeltaK->displayText().toFloat(&isOk);
    if(isOk){
        emit DeltaKReset(DeltaK);
    }else{
        ui->lineEdit_DeltaK->setText("操作失败");
    }

}


void ParaWidget::on_pushButton_KPara_clicked()
{
    float KPara;
    bool isOk;
    KPara = ui->lineEdit_KPara->displayText().toFloat(&isOk);
    if(isOk){
        emit KParaReset(KPara);
    }else{
        ui->lineEdit_KPara->setText("操作失败");
    }

}



void  ParaWidget::ShowPara_Tr(float value)
{
    ui->lineEdit_Tr->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_Tz(float value)
{
    ui->lineEdit_Tz->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_Tg(float value)
{
    ui->lineEdit_Tg->setText(QString::number(value,'f',3));
}


void  ParaWidget::ShowPara_DeltaK(float value)
{
    ui->lineEdit_DeltaK->setText(QString::number(value,'f',3));
}


void  ParaWidget::ShowPara_KPara(float value)
{
    ui->lineEdit_KPara->setText(QString::number(value,'f',3));
}


void  ParaWidget::ShowPara_Vg(float value)
{
    ui->lineEdit_Vg->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_Vss(float value)
{
    ui->lineEdit_Vss->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_AWFA_WD(float value)
{
    ui->lineEdit_awfaWdefault->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_AWFA_WMin(float value)
{
    ui->lineEdit_awfaWmin->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_AWFA_WMax(float value)
{
    ui->lineEdit_awfaWmax->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_AWFA_WAC(float value)
{
    ui->lineEdit_awfaAC->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_trackPeriod(quint8 T)
{
    ui->lineEdit_trackPeriod->setText(QString::number(T));
}

void  ParaWidget::ShowPara_trackError_Min(float value)
{
     ui->lineEdit_trackErrorMin->setText(QString::number(value,'f',3));
}

void  ParaWidget::ShowPara_trackError_Max(float value)
{
    ui->lineEdit_trackErrorMax->setText(QString::number(value,'f',3));
}

void ParaWidget::on_pushButton_trackPeriod_clicked()
{
    emit TrackParaReset(1,ui->lineEdit_trackPeriod->displayText().toFloat());
}

void ParaWidget::on_pushButton_trackErrorMin_clicked()
{
    emit TrackParaReset(2,ui->lineEdit_trackErrorMin->displayText().toFloat());
}

void ParaWidget::on_pushButton_trackErrorMax_clicked()
{
    emit TrackParaReset(3,ui->lineEdit_trackErrorMax->displayText().toFloat());
}


void ParaWidget::on_pushButton_awfaWdefault_clicked()
{

    emit AWFAParaReset(1,ui->lineEdit_awfaWdefault->displayText().toFloat());
}


void ParaWidget::on_pushButton_awfaAC_clicked()
{
    emit AWFAParaReset(2,ui->lineEdit_awfaAC->displayText().toFloat());
}


void ParaWidget::on_pushButton_awfaWmin_clicked()
{
    emit AWFAParaReset(3,ui->lineEdit_awfaWmax->displayText().toFloat());
}


void ParaWidget::on_pushButton_awfaWmax_clicked()
{
    emit AWFAParaReset(4,ui->lineEdit_awfaWmin->displayText().toFloat());
}

